#ifndef _DIVA_VMSTUB_H_
#define _DIVA_VMSTUB_H_

#include <string>
#include "DIVA_AbstractVMStub.h"
#include "OgreVMStub.h"
#include <fstream>
#include <boost/archive/text_oarchive.hpp>
#include <boost/archive/text_iarchive.hpp>
#include <boost/serialization/vector.hpp>
using namespace std;

class DIVA_VMStub: public DIVA_AbstractVMStub, public OgreVMStub {
private:
	friend class boost::serialization::access;
	template<class Archive>
	void serialize(Archive & ar, const unsigned int version)
	{
		ar &_name;
		ar &_visible;
		ar &_movable;
// 		ar &_textvisible ;
// 		ar &_vm_name_position;
// 		ar &_prohibit_defaults;
// 		ar &_para_onoff;
// 		ar &*_vm_rx;
// 		ar &*_vm_ry;
// 		ar &*_vm_rz;
// 		ar &_vm_rx_val;
// 		ar &_vm_ry_val;
// 		ar &_vm_rz_val;
// 		ar &_vm_rx_str;
// 		ar &_vm_ry_str ;
// 		ar &_vm_rz_str ;
// 		ar &*_vm_sizex;
// 		ar &*_vm_sizey;
// 		ar &*_vm_sizez;
// 		ar &_vm_sizex_val; 
// 		ar &_vm_sizey_val;
// 		ar &_vm_sizez_val;
// 		ar &_vm_sizex_str; 
// 		ar &_vm_sizey_str;
// 		ar &_vm_sizez_str;
// 		ar &_vm_init_sizex;
// 		ar &_vm_init_sizey;
// 		ar &_vm_init_sizez;
// 		ar &*_vm_sizexscale;
// 		ar &*_vm_sizeyscale;
// 		ar &*_vm_sizezscale;
// 		ar &_vm_sizexscale_val;
// 		ar &_vm_sizeyscale_val;
// 		ar &_vm_sizezscale_val;
// 		ar &_vm_sizexscale_str;
// 		ar &_vm_sizeyscale_str;
// 		ar &_vm_sizezscale_str;
// 		ar &*_vm_r;
// 		ar &*_vm_g;
// 		ar &*_vm_b;
// 		ar &_vm_r_val;
// 		ar &_vm_g_val;
// 		ar &_vm_b_val;
// 		ar &_vm_r_str;
// 		ar &_vm_g_str;
// 		ar &_vm_b_str;
// 		ar &*_vm_transparency;
// 		ar &_vm_transparency_val;
// 		ar &_vm_transparency_str;
// 		ar &*_vm_yaw;
// 		ar &*_vm_pitch;
// 		ar &*_vm_roll;
// 		ar &_vm_yaw_val;
// 		ar &_vm_pitch_val;
// 		ar &_vm_roll_val;
// 		ar &_vm_yaw_str;
// 		ar &_vm_pitch_str;
// 		ar &_vm_roll_str;
// 		ar &_vm_quat_str;
// 		ar &*_vm_clickmsg;
// 		ar &_vm_clickmsg_val;
// 		ar &_vm_clickmsg_position;

	}
protected:
	DIVA_VMStub() {};
	bool _movable ; 
	bool _textvisible ;
	bool _prohibit_defaults[10] ;
	vector<bool> _para_onoff ;
	string _name;
	int _vm_name_position;
	float* _vm_rx;   // the RELATIVE (x,y,z) to its parent scene node
	float* _vm_ry;
	float* _vm_rz;
	float _vm_rx_val ; // the real variables that keep the values obtained from _vm_rx ;
	float _vm_ry_val ; // the real variables that keep the values obtained from _vm_ry ;
	float _vm_rz_val ; // the real variables that keep the values obtained from _vm_rz ;
	string _vm_rx_str ; // the real variables that keep the values obtained from _vm_rx ;
	string _vm_ry_str ; // the real variables that keep the values obtained from _vm_ry ;
	string _vm_rz_str ; // the real variables
	float* _vm_sizex;
	float* _vm_sizey;
	float* _vm_sizez;
	float _vm_sizex_val; // the real variables that keep the values obtained from _vm_sizex ;
	float _vm_sizey_val;
	float _vm_sizez_val;
	string _vm_sizex_str; // the real variables that keep the values obtained from _vm_sizex ;
	string _vm_sizey_str;
	string _vm_sizez_str;
	float _vm_init_sizex ;
	float _vm_init_sizey ;
	float _vm_init_sizez ;
	double* _vm_sizexscale;
	double* _vm_sizeyscale;
	double* _vm_sizezscale;
	double _vm_sizexscale_val;
	double _vm_sizeyscale_val;
	double _vm_sizezscale_val;
	string _vm_sizexscale_str;
	string _vm_sizeyscale_str;
	string _vm_sizezscale_str;
	double * _vm_r ;  
	double * _vm_g ;
	double * _vm_b ;
	double  _vm_r_val ;  
	double  _vm_g_val ;
	double  _vm_b_val ;
	string  _vm_r_str ;  
	string  _vm_g_str ;
	string  _vm_b_str ;
	double * _vm_transparency ; // the degree of transparency of a VM
	double _vm_transparency_val ;
	string _vm_transparency_str ;
	int * _vm_yaw;             
	int * _vm_pitch;
	int * _vm_roll;
	int  _vm_yaw_val;            
	int  _vm_pitch_val;
	int  _vm_roll_val;
	string  _vm_yaw_str;            
	string  _vm_pitch_str;
	string  _vm_roll_str;
	string  _vm_quat_str ;
	string * _vm_clickmsg ;
	string _vm_clickmsg_val ;
	int  _vm_clickmsg_position ;
	bool _visible ;
public:
	//hyt 08/10/20
	enum Coordinate_axis {X_Max,Y_Max,Z_Max,X_Min,Y_Min,Z_Min,X_Positive_Stretch,Y_Positive_Stretch,Z_Positive_Stretch,DO_NOTHING};
	// hyt 08/10/20
	enum TextPosition {TOP,BOTTOM,LEFT,RIGHT,FRONT,BACK,CENTER};
	enum Prohibit	{ SKIP_NAME, SKIP_POSITION, SKIP_SIZE, SKIP_SCALE, SKIP_COLOR, SKIP_ROTATION,SKIP_TRANS, SKIP_QUATERNION, SKIP_CLICKMSG};
	static const int RC = 2 ; // the offset of _vm_rx ;
	static const int SIZE = RC+3 ; // the offset of _vm_sizex 
	static const int SCALE =SIZE+3 ;// the offset of _vm_sizexscale 
	static const int RGB = SCALE + 3 ; // the offset of _vm_r ;
	static const int TRANS = RGB + 3 ; // the offset of _vm_transparency ;
	static const int ROTATE = TRANS+1 ; // the offset of _vm_yaw ; 
	static const int QUAT = ROTATE + 3 ; // the offset of _vm_quat 
	static const int CLICKMSG = QUAT + 1 ;
	static const int INIT_VM_SIZE = 100 ;

	static const int INIT_YAW = 0 ;
	static const int INIT_PITCH = 0 ;
	static const int INIT_ROLL = 0 ;
	static const int TEXT_HEIGHT = 30 ;
	string get_vm_name();
	virtual bool get_visible();
	void VMPicked(Ogre::Real x,Ogre::Real y,Ogre::Real z);

};

#endif